<template>
  <div>
    子组件中显示name的值:{{obj.name}}
    子组件中显示age的值:{{obj.age}}
    <button @click="changeName">改变数据</button>
    <button @click="emit">触发方法</button>
  </div>
</template>
<script>
import Bus from './Bus.js'
export default {
  data() {
    return {
      obj: Bus
    }
  },
  methods: {
    changeName() {
      // debugger
      this.obj.name = 'xxxx'
      this.obj.age = 50
    },
    emit() {
      this.obj.$emit('postdata', 'data2222')
    }
  }
}
</script>
